#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QTime>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
private:
    Ui::MainWindow *ui;
    QSerialPort m_serialPort;
    QTimer *m_pTimer;
    void scanSerial();
    void XLK_DataLoad();
    char* hexStr_To_Hexchar(QString data);

    void SendData(QByteArray data);
    void Delay(int msec);
private slots:
    void on_pushButton_clicked();
    void on_AN_FNComProt_clicked();
    void on_XLK_ComName_activated(int index);
    void on_XLK_ComPort_activated(int index);
    void readData();

    void on_AN_ClearRece_clicked();

    void on_AN_ClearSend_clicked();

    void on_AN_Send_clicked();

    void on_XZK_HEXSend_clicked(bool checked);

    void handleTimeout();
    void on_AN_StopSend_clicked();
    void on_XZK_TimerSend_clicked(bool checked);

    void on_AN_SendArray_clicked();

    void on_AN_SendItem_clicked();
    void on_AN_OpenFile_clicked();
    void on_AN_SendFile_clicked();
    void on_AN_ClearSendCount_clicked();
    void on_AN_ClearReceCount_clicked();
};
#endif // MAINWINDOW_H
